﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="catalogProductsVarious.aspx.cs"
    Inherits="catalogProductsVarious" EnableViewState="true" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<%@ Register Src="~/Admin/catalogProductsVariousDetailCtrl.ascx" TagName="catalogProductsVariousDetailCtrl"
    TagPrefix="ucpd" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Catalogo Subcategorias</title>
    <style type="text/css">
        .fontLabel
        {
            font-family: Calibri;
            font-size: medium;
        }
        .textField
        {
            padding-left: 15px;
        }
        .buttonExtNet
        {
            height: 22px;
            vertical-align: bottom;
        }
    </style>
    <script type="text/javascript">
        var messageLoading = 'Cargando...';
        function fnOnClick(sender, e) {
            if (e == 'Edit' || e == 'New') {
                var id = 0;
                if (e == 'Edit') {
                    id = sender.Id;
                }
                App.direct.ShowDetails(id);
            } else if (e == 'Delete') {
                var messageConfirm = 'Esta seguro que desea eliminar el Registro seleccionado?';
                var messageConfirmationTitle = 'Confirmacion';
                Ext.MessageBox.confirm(messageConfirmationTitle, messageConfirm, function (btn) {
                    if (btn == 'yes') {
                        if (sender.Id) {
                            App.direct.DeleteProduct(sender.Id);
                        }
                    }
                });
            }
        }
        function reloadGrid() {
            var btnsearchCtrl = Ext.get('btnSearch');
            if (btnsearchCtrl) { btnsearchCtrl.dom.click(); }
            else if (btnsearch) { btnsearch.dom.click(); }

        }
        var employeeDetailsRender = function () {
            return '<img class="imgEdit" ext:qtip="Click to view/edit additional details" style="cursor:pointer;" src="vcard_edit.png" />';
        };

        var cellClick = function (view, cell, columnIndex, record, row, rowIndex, e) {
            var t = e.getTarget(),
                columnId = this.columns[columnIndex].id; // Get column id

            if (t.className == "imgEdit" && columnId == "Details") {
                //the ajax call is allowed
                return true;
            }

            //forbidden
            return false;
        };

    </script>
</head>
<body>
    <form runat="server">
    <div>
        <ext:ResourceManager ID="ResourceManagerCatalog" runat="server" />
        <ext:Viewport ID="ViewPortUserInformation" runat="server" Layout="border">
            <Items>
                <ext:FormPanel ID="fpnlCatalogSearch" runat="server" Icon="LayoutHeader" Region="Center"
                    MonitorPoll="500" MonitorValid="true" Height="400" Layout="FitLayout" ButtonAlign="Right">
                    <TopBar>
                        <ext:Toolbar ID="tbarTopMenuCatalog" runat="server">
                            <Items>
                                <ext:Button ID="btnSearch" runat="server" Icon="ArrowRefresh" Text="Actualizar" ClientIDMode="Static">
                                    <DirectEvents>
                                        <Click OnEvent="btnSearch_Click" Success="this.enable();" Timeout="100000">
                                            <EventMask MinDelay="200" ShowMask="true" />
                                        </Click>
                                    </DirectEvents>
                                </ext:Button>
                                <ext:Button ID="btnNew" runat="server" Icon="ApplicationFormAdd" Text="Nuevo Registro">
                                    <Listeners>
                                        <Click Handler="fnOnClick(this,'New')" />
                                    </Listeners>
                                </ext:Button>
                            </Items>
                        </ext:Toolbar>
                    </TopBar>
                    <Items>
                        <ext:Panel ID="pnlCatalogSearch" runat="server" Border="false" Header="false" Layout="FitLayout"
                            LabelAlign="Left" Margin="5">
                            <Defaults>
                                <ext:Parameter Name="AllowBlank" Value="false" Mode="Raw" />
                                <ext:Parameter Name="MsgTarget" Value="side" />
                            </Defaults>
                            <Items>
                                <ext:FieldSet ID="fsetResultSearch" runat="server" Border="true" Layout="FitLayout"
                                    Margin="15" ButtonAlign="Right" Title="Listado Catalogo">
                                    <Items>
                                        <ext:GridPanel ID="gridREsults" runat="server" Border="True" Padding="1" MinHeight="400"
                                            Height="510" MinWidth="750" Width="900" AutoScroll="true">
                                            <Store>
                                                <ext:Store ID="Store1" runat="server" PageSize="20" ClientIDMode="Static" OnReadData="Store1_RefreshData">
                                                    <Model>
                                                        <ext:Model ID="Model1" runat="server" IDProperty="Id">
                                                            <Fields>
                                                                <ext:ModelField Name="Id" />
                                                                <ext:ModelField Name="Name" />
                                                                <ext:ModelField Name="ShortDescription" />
                                                                <ext:ModelField Name="LowerPrice" />
                                                                <ext:ModelField Name="Size" />
                                                                <ext:ModelField Name="MesesFloracion" />
                                                                <ext:ModelField Name="MesesFrutos" />
                                                                <ext:ModelField Name="PictureUrl" />
                                                            </Fields>
                                                        </ext:Model>
                                                    </Model>
                                                </ext:Store>
                                            </Store>
                                            <ColumnModel ID="ColumnModel1" runat="server">
                                                <Columns>
                                                    <ext:TemplateColumn ID="TemplateColumn1" runat="server" Text="Archivo" Flex="15"
                                                        DataIndex="url" TemplateString='<img style="width:60px;height:45px;" src="{PictureUrl}" />' />
                                                    <ext:Column ID="colId" runat="server" Header="Id" DataIndex="Id" />
                                                    <ext:Column ID="colName" runat="server" Header="Nombre" DataIndex="Name" MinWidth="125" />
                                                    <ext:Column ID="colShortDescription" runat="server" Header="Descripcion Corta" DataIndex="ShortDescription"
                                                        MinWidth="200" />
                                                    <ext:Column ID="colLowerPrice" runat="server" Header="PrecioMasBajo" DataIndex="LowerPrice"
                                                        MinWidth="150" />
                                                    <ext:Column ID="colSize" runat="server" Header="Altura" DataIndex="Size" MinWidth="125" />
                                                    <ext:Column ID="colMesesFloracion" runat="server" DataIndex="MesesFloracion" Header="MesesFloracion" />
                                                    <ext:Column ID="colMesesFrutos" runat="server" DataIndex="MesesFrutos" Header="MesesFrutos" />
                                                    <ext:CommandColumn runat="server">
                                                        <Commands>
                                                            <ext:GridCommand Icon="BulletCross" CommandName="Delete" StandOut="true">
                                                                <ToolTip Text="Delete" />
                                                            </ext:GridCommand>
                                                            <ext:CommandSeparator />
                                                            <ext:GridCommand Icon="NoteEdit" CommandName="Edit" StandOut="true">
                                                                <ToolTip Text="Edit" />
                                                            </ext:GridCommand>
                                                        </Commands>
                                                        <Listeners>
                                                            <Command Handler="fnOnClick(record.data,command);" />
                                                        </Listeners>
                                                    </ext:CommandColumn>
                                                </Columns>
                                            </ColumnModel>
                                            <View>
                                                <ext:GridView ID="GridView1" runat="server" LoadMask="true" />
                                            </View>
                                            <SelectionModel>
                                                <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" Mode="Single" />
                                            </SelectionModel>
                                            <BottomBar>
                                                <ext:PagingToolbar ID="PagingToolbar1" runat="server" PageSize="20">
                                                </ext:PagingToolbar>
                                            </BottomBar>
                                        </ext:GridPanel>
                                    </Items>
                                </ext:FieldSet>
                            </Items>
                        </ext:Panel>
                    </Items>
                    <BottomBar>
                        <ext:StatusBar ID="stbarUserInformation" runat="server" Height="15" />
                    </BottomBar>
                </ext:FormPanel>
            </Items>
        </ext:Viewport>
        <ucpd:catalogProductsVariousDetailCtrl ID="WindowEditorProductsVarious" runat="server" />
    </div>
    </form>
</body>
</html>
